#include "../source/server.hpp"

#include <stdio.h>

int main(void)
{
    Socket client;
    client.CreateClient(8080, "127.0.0.1");
    // client 先发送给 server 要处理的任务
    std::string str = "nihao";
    ssize_t ret = client.Send(str.c_str(), sizeof(str));
    if (ret <= 0)
    {
        ERR_LOG("client send error");
        return 0;
    }

    // client 再接收 server 的处理返回的结果
    char buffer[1024] = {0};
    ret = client.Recv(buffer, sizeof(buffer) - 1);
    if (ret <= 0)
    {
        ERR_LOG("client recv error");
        return 0;
    }
    printf("server# %s\n", buffer);
    client.Close();

    return 0;
}